class PageofficeDealDataService {
  /**
   * @Description: POBrowser调用
   * @author zhuguangkui
   */
  openPageOfficePage(url) {
    const height = window.screen.availHeight;
    const width = window.screen.availWidth;
    const a = document.createElement("a");
    console.log(url);
    a.href = "javascript:POBrowser.openWindowModeless('" + url + "' ,'width=" + width + ";height=" + height + ";');";
    console.log(a.href);
    a.target = "_self";
    a.click();
    const e = document.createEvent("MouseEvents");
    e.initEvent("click", true, true);
    a.dispatchEvent(e);
  }
  /**
   * @Description: 将参数拼接至url后面
   * @author zhuguangkui
   */
  getParameterOfUrl(url, parameterMap) {
    let connectiveSymbol = "";
    if (url.indexOf("?") !== -1) {
      connectiveSymbol = "&";
    } else {
      connectiveSymbol = "?";
    }
    if (parameterMap) {
      let mark = 0;
      parameterMap.forEach(function (val, key) {
        if (mark === 0) {
          if (val != null && val !== "null" && val !== "undefined") {
            url += connectiveSymbol + key + "=" + val;
          } else {
            url += connectiveSymbol + key + "=";
          }
        } else {
          if (val != null && val !== "null" && val !== "undefined") {
            url += "&" + key + "=" + val;
          } else {
            url += "&" + key + "=";
          }
        }
        mark++;
      });
    }
    return url;
  }
}
const pageOfficeDealDataService = new PageofficeDealDataService();
export { pageOfficeDealDataService };
